package user

import (
	"APi/client"
	"APi/response"
	"github.com/gin-gonic/gin"
	user "user_srv/proto"
)

func CouponList(c *gin.Context) {
	userId := c.GetUint("userId")
	list, err := client.CouponList(c, &user.CouponListRequest{UserId: int64(userId)})
	if err != nil {
		response.CurrencyErrResponse(c, -1, err.Error())
		return
	}
	response.CurrencySuccessResponse(c, "可领取优惠券列表查询成功", map[string]interface{}{"coupon_list": list.AllCouponList})
}
